# _*_ coding: utf-8 _*_
# @Time : 2024-01-15 21:20
# @Author : wf

import urllib.request as request

url = 'http://www.baidu.com'

#
response = request.urlopen(url)
# <class 'http.client.HTTPResponse'>
print(type(response))
# 1、按照一字节 一字节 的读取
# response.read()

# 2、设置读取的字节数
# response.read(1024)

# 3、读取一行
# content = response.readline()

# 4、读取所有行
# content = response.readlines()
# print(content)

# 响应状态码
print(response.getcode())

# 请求地址
print(response.geturl())

# 响应头
print(response.getheaders())

